<template>
  <div class="common-layout">
    <el-container class="h-screen">
      <el-aside class="transition-all duration-300 h-full" :width="menuStore.menuWidth">
        <admin-menu></admin-menu>
      </el-aside>
      <el-container>
        <el-header style="height: 110px">
          <admin-header></admin-header>
          <admin-nav-list></admin-nav-list>
        </el-header>
        <el-main>
          <!-- 主内容（根据路由动态展示不同页面） -->
          <router-view v-slot="{ Component }">
            <Transition name="fade">
              <keep-alive :max="10">
                <component :is="Component"></component>
              </keep-alive>
            </Transition>
          </router-view>
        </el-main>
        <el-footer>
          <admin-footer></admin-footer>
        </el-footer>
      </el-container>
    </el-container>
  </div>
</template>


<script setup>
// 导入其他组件
import AdminHeader from './component/AdminHeader.vue';
import AdminMenu from './component/AdminMenu.vue';
import AdminNavList from './component/AdminNavList.vue';
import AdminFooter from './component/AdminFooter.vue';
import { useMenuStore } from '@/stores/menu';


//侧边导航栏宽度
const menuStore = useMenuStore()

</script>

<style scoped>
.el-header {
  padding: 0 !important;
}

.el-footer {
  padding: 0;
}

/* 内容区域过渡动画：淡入淡出效果 */
/* 刚开始进入时 */
.fade-enter-from {
    /* 透明度 */
    opacity: 0;
}

/* 刚开始结束 */
.fade-enter-to {
    opacity: 1;
}

/* 刚开始离开 */
.fade-leave-from {
  opacity: 1;
}

/* 离开已结束 */
.fade-leave-to {
  opacity: 0;
}

/* 离开进行中 */
.fade-leave-active {
    transition: all 0.3s;
}

/* 进入进行中 */
.fade-enter-active {
    transition: all 0.3s;
    transition-delay: 0.3s;
}
</style>